package com.joycessh.action;

import java.util.List;

import com.joycessh.dao.ITopicHbmDao;
import com.joycessh.dao.impl.TopicHbmDaoImpl;
import com.joycessh.po.TopicPO;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class TopicAction extends ActionSupport {

	/**
	 * @author joycessh
	 */
	private static final long serialVersionUID = 1L;
	
	private ITopicHbmDao hbmDao;
	private TopicPO topic;
	private String key;
	public TopicPO getTopic() {
		return topic;
	}

	public void setTopic(TopicPO topic) {
		this.topic = topic;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}		

	
	@SuppressWarnings("unchecked")
	@Override
	public String execute() {
		// TODO Auto-generated method stub
		hbmDao = new TopicHbmDaoImpl();
		//1调用dao获得帖子列表  
        List<TopicPO> list = hbmDao.findAll(key);  
        //2 将帖子列表放入ActionContext中  session
        ActionContext.getContext().getSession().put("list", list);  
          
        return "list";  
	}


}
